package com.woniu.springmvc.handler;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @program: JavaEE-EFD
 * @description: springmvc中的Handler
 * @author: fengjd
 * @create: 2022-07-28 19:43
 **/

@Controller // 此标记意在说明,此类是springmvc 中的handler
@RequestMapping("/UserHander")
public class UserHandler {

    @RequestMapping("/login")
    public String doLogin(HttpServletRequest request, HttpServletResponse response){
        String userName = request.getParameter("userName");
        String password = request.getParameter("password");
        if ("admin".equals(password) && "admin".equals(userName)) {
            return "success";
        } else {
            return "fail";// 逻辑视图名
        }
    }
}
